<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class myPromise {
            constructor(handel) {
                this['[[PromiseState]]'] = 'pending';
                this['[[PromiseResult]]'] = undefined;
                // handel(this._resolve,this._reject) 
                handel((val) => {
                    console.log(this);
                    this['[[PromiseState]]'] = "fulfilled";
                    this['[[PromiseResult]]'] = val;
                }, (err) => {
                    this['[[PromiseState]]'] = "rejected";
                    this['[[PromiseResult]]'] = err;
                })

            }
            // _resolve(val) {
            //     console.log(this);
            //     this['[[PromiseState]]'] = "fulfilled";
            //     this['[[PromiseResult]]'] = val;
            // }
            // _reject(val) {
            //     this['[[PromiseState]]'] = "rejected";
            //     this['[[PromiseResult]]'] = val;
            // }
        }
        let p = new myPromise((resolve, reject) => {
            resolve('aa');
            // reject('sss');
        })
        console.log(p);
    </script>
</body>
</html>